function api_ready(callback) {
    //android下
    if (typeof GLOBAL != "undefined") {
        return callback();
    }
    //ios下
    function WebViewJavascriptBridgeReady(cb) {
        if (window.WebViewJavascriptBridge) {
            cb(WebViewJavascriptBridge)
        } else {
            document.addEventListener('WebViewJavascriptBridgeReady', function () {
                cb(WebViewJavascriptBridge)
            }, false);
        }
    }

    WebViewJavascriptBridgeReady(function (bridge) {
        window.GLOBAL = {
            share: function (title, content, url, img) {
                bridge.callHandler('share', {'title': title, 'content': content, 'url': url, 'img': img});
            },
            initXG: function (username) {
                bridge.callHandler('initXG', {'username': username});
            },
            openQRCodeReader: function () {
                bridge.callHandler('openQRCodeReader', {});
            }
        };
        callback();
    });

}